package net.util;


import org.lwjgl.input.Mouse;

public class MouseUtil
{
	private MouseUtil()
	{
		
	}
	
	private static boolean mousedown, prevmousedown;
	
	public static void update()
	{
		prevmousedown = mousedown;
		mousedown = Mouse.isButtonDown(0);
	}
	
	public static boolean mousePressed()
	{
		return mousedown && ! prevmousedown;
	}
	
	public static boolean mouseReleased()
	{
		return ! mousedown && prevmousedown;
	}

	public static boolean mouseDragged()
	{
		return mousedown && prevmousedown && mouseMoved();
	}

	public static boolean mouseMoved()
	{
		return Mouse.getDX() != 0 || Mouse.getDY() != 0;
	}
}
